#include "dialogs/DialogHelp.h"

#include "scenes/SceneMainMenu.h"

DialogHelp::DialogHelp( GameApplication& theApp, gdn::Scene& theScene )
   : App( theApp ),
     Scene( theScene )
{
	// None
}

void DialogHelp::Initialize()
{
	background.SetImage( *App.Images.GetResource( App.GameResources[ "gui dialog background" ] ) );

	gdn::Image* buttonSmallImage = App.Images.GetResource( App.GameResources[ "gui button small" ] );
	gdn::Font * font             = App.Fonts.GetResource( App.GameResources[ "font sansation" ] );

	closeButton = gui::Button( gdn::Vector2f( 244, 0 ),
							   "X", "X", "X",
							   gdn::Color( 0, 0, 0 ), gdn::Color( 0, 0, 0 ), gdn::Color( 255, 255, 255 ),
				               *buttonSmallImage, *font, 15,
				               gdn::Rectanglei( 0, 0, 24, 24 ), gdn::Rectanglei( 24, 0, 24, 24 ), gdn::Rectanglei( 48, 0, 24, 24 ) );
}

void DialogHelp::Terminate()
{
	// None
}

void DialogHelp::Step( gdn::Event& Event )
{
	if ( closeButton.Process( Event ) == GUI_BUTTON_RELEASE )
	{
		static_cast< SceneMainMenu& >( Scene ).CloseDialog();
	}
}

void DialogHelp::Draw( gdn::RenderImage& renderImage )
{
	renderImage.Clear();

	renderImage.Draw( background );
	closeButton.Draw( renderImage );

	renderImage.Display();
}
